<?php
namespace Admin\Model;
use Think\Model;
/**
* ContentModel
*/
class ContentModel extends Model
{
	protected $tableName = "";
	//初始化
    protected function _initialize($table="category") {
        parent::_initialize();
        $this->tableName = $table;
    }
	public function make_tree1($list,$root=0){
		$tree=array();
		foreach($list as $key => $val){
			if($val['parentid'] == $root){
				//获取当前$pid所有子类 
				unset($list[$key]);
				if(!empty($list)){
					$child = $this->make_tree1($list,$val['cateid']);
					if(!empty($child)){
						$val['children'] = $child;
						$val['spread'] = "true";
					} else {
						if ($val['is_final']) {
							$value['href'] = '/admin/Content/cateContent/cateid/'.$val['cateid'].'/modelid/'.$val['modelid'];
						} else {
							$value['href'] = "javascript:alert('不是终极栏目');";
						}
					}
					$value['spread'] = $val['spread'];
					$value['children'] = $val['children'];
					$value['name'] = $val['catename'];
					$value['id'] = $val['cateid'];
				}
				$tree[] = $value;
			}
		}
		return $tree;
	}
}